﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EasyTrader.Manager
{
    using PriceSignalList = List<EasyTrader.Signal.PriceSignal>;

    

    public class SysManager
    {

        protected EasyTrader.Order.OrderManager m_OrderMan = new EasyTrader.Order.OrderManager();
        public EasyTrader.Order.OrderManager OrderMan
        {
            get { return m_OrderMan; }
            set { m_OrderMan = value; }
        }
        protected EasyTrader.Signal.TotalSignalManager m_TotalSigMan = new EasyTrader.Signal.TotalSignalManager();
        public EasyTrader.Signal.TotalSignalManager TotalSigMan
        {
            get { return m_TotalSigMan; }
            set { m_TotalSigMan = value; }
        }
        protected string m_SysName = "";
        public string SysName
        {
            get { return m_SysName; }
            set { m_SysName = value; }
        }
        protected string m_LogFileName = "";
        public string LogFileName
        {
            get { return m_LogFileName; }
            set { m_LogFileName = value; }
        }
        protected int m_SysType = 0;
        public int SysType
        {
            get { return m_SysType; }
            set { m_SysType = value; }
        }

        protected int m_FirstSig = 0;
        public int FirstSig
        {
            get { return m_FirstSig; }
            set { m_FirstSig = value; }
        }

        // 임시 변수임. 임시변수 외에 다른 용도로 사용을 금함.
        protected EasyTrader.Signal.PriceSignal m_CurState = new EasyTrader.Signal.PriceSignal();
        

        // 시스템의 신호 목록, 매수, 매도, 매수청산, 매도 청산을 포함한다.
        protected PriceSignalList m_PriceSignalList = new PriceSignalList();
        public PriceSignalList PriceSignalList
        {
            get { return m_PriceSignalList; }
            set { m_PriceSignalList = value; }
        }

        // 시스템의 상태 목록 상승과 하락을 포함한다.
        // 신호를 발생시키는 근거가 된다.
        protected PriceSignalList m_PriceStateList = new PriceSignalList();
        public PriceSignalList PriceStateList
        {
            get { return m_PriceStateList; }
            set { m_PriceStateList = value; }
        }
        // 상태 전환에 의하여 신호를 발생 시킨다.
        protected EasyTrader.Signal.PriceSignal GetSignalByStateChange()
        {
            EasyTrader.Signal.PriceSignal lastSignal = m_TotalSigMan.GetLastSignal(m_PriceSignalList);
            // 가장 최근의 상태를 가져 온다. 이 상태를 바탕으로 새로운 신호를 만들어 낸다.
            EasyTrader.Signal.PriceSignal lastState = m_TotalSigMan.GetLastSignal(m_PriceStateList);
            if (lastState == null)
                return null;
            // 현재 상태 번호를 구한다.
            int curStateNumber = m_PriceStateList.Count;
            if (lastSignal != null)
            {
                // 이전 신호와 현재 상태 번호가 같을 때는 아무일도 하지 않는다.
                if (lastSignal.StateNumber == curStateNumber)
                    return null;
                // 이전 신호와 현재 신호 타입이 같을 때는 아무일도 하지 않는다.
                if (lastSignal.Type == lastState.Type)
                    return null;
            }

            int signalVal = GlobalVar.SignalNone;
            if (lastState.Type == GlobalVar.SignalBuy)
            {
                signalVal = GlobalVar.SignalBuy;
                m_TotalSigMan.SetSignalInfo(m_PriceStateList.Count, signalVal, GlobalVar.SignalStateTrans, ref m_CurState);
                m_TotalSigMan.WriteSignalLog("매수 전환 신호 발생", m_LogFileName, m_CurState);
                return m_CurState;
            }
            else if (lastState.Type == GlobalVar.SignalSell)
            {
                signalVal = GlobalVar.SignalSell;
                m_TotalSigMan.SetSignalInfo(m_PriceStateList.Count, signalVal, GlobalVar.SignalStateTrans, ref m_CurState);
                m_TotalSigMan.WriteSignalLog("매도 전환 신호 발생", m_LogFileName, m_CurState);
                return m_CurState;
            }
            else if (lastState.Type == GlobalVar.SignalExitBuy)
            {
                signalVal = GlobalVar.SignalExitBuy;
                m_TotalSigMan.SetSignalInfo(m_PriceStateList.Count, signalVal, GlobalVar.SignalStateLiquid, ref m_CurState);
                m_TotalSigMan.WriteSignalLog("매수 청산 신호 발생", m_LogFileName, m_CurState);
                return m_CurState;
            }
            else if (lastState.Type == GlobalVar.SignalExitSell)
            {
                signalVal = GlobalVar.SignalExitSell;
                m_TotalSigMan.SetSignalInfo(m_PriceStateList.Count, signalVal, GlobalVar.SignalStateLiquid, ref m_CurState);
                m_TotalSigMan.WriteSignalLog("매도 청산 신호 발생", m_LogFileName, m_CurState);
                return m_CurState;
            }

            return null;
        }

        // 값에 의한 청산에 의하여 청산 신호를 발생시킨다.
        protected EasyTrader.Signal.PriceSignal GetLiquidSignalByPerPrice()
        {
            EasyTrader.Signal.PriceSignal lastSignal = m_TotalSigMan.GetLastSignal(m_PriceSignalList);
            if (lastSignal == null || lastSignal.Type == GlobalVar.SignalExitBuy || lastSignal.Type == GlobalVar.SignalExitSell)
                return null;

            double curVal = m_TotalSigMan.CurVal;
            // 현재 값이 설정되어 있지 않을 때는 아무일도 하지 않는다.
            if (curVal == 0.0)
                return null;
            double curProfit = m_TotalSigMan.CalcCurProfit(m_PriceSignalList, curVal);
            double totalProfit = m_TotalSigMan.CalcTotalProfit(m_PriceSignalList, curVal);
            int signalVal = GlobalVar.SignalNone;
            if (lastSignal.Type == GlobalVar.SignalBuy)
                signalVal = GlobalVar.SignalExitBuy;
            else if (lastSignal.Type == GlobalVar.SignalSell)
                signalVal = GlobalVar.SignalExitSell;

            bool enableTotalProfitLiquid = false;
            bool enableTotalLossLiquid = false;
            bool enablePerProfitLiquid = false;
            bool enablePerLossLiquid = false;
            double totalProfitLiquidValue = 0.0;
            double totalLossLiquidValue = 0.0;
            double perProfitLiquidValue = 0.0;
            double perLossLiquidValue = 0.0;

            if (m_SysType == GlobalVar.SysTypeJisuWaveHogaSummit)
            {
                enableTotalProfitLiquid = JisuWaveHogaSummitSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = JisuWaveHogaSummitSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = JisuWaveHogaSummitSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = JisuWaveHogaSummitSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = JisuWaveHogaSummitSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = JisuWaveHogaSummitSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = JisuWaveHogaSummitSysVar.PerProfitLiquidValue;
                perLossLiquidValue = JisuWaveHogaSummitSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeJisuWave)
            {
                enableTotalProfitLiquid = JisuWaveSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = JisuWaveSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = JisuWaveSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = JisuWaveSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = JisuWaveSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = JisuWaveSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = JisuWaveSysVar.PerProfitLiquidValue;
                perLossLiquidValue = JisuWaveSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaWave)
            {
                enableTotalProfitLiquid = HogaWaveSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = HogaWaveSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = HogaWaveSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = HogaWaveSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = HogaWaveSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = HogaWaveSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = HogaWaveSysVar.PerProfitLiquidValue;
                perLossLiquidValue = HogaWaveSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSquareOcc)
            {
                enableTotalProfitLiquid = HogaSquareOccSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = HogaSquareOccSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = HogaSquareOccSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = HogaSquareOccSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = HogaSquareOccSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = HogaSquareOccSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = HogaSquareOccSysVar.PerProfitLiquidValue;
                perLossLiquidValue = HogaSquareOccSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSummit)
            {
                enableTotalProfitLiquid = HogaSummitSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = HogaSummitSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = HogaSummitSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = HogaSummitSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = HogaSummitSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = HogaSummitSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = HogaSummitSysVar.PerProfitLiquidValue;
                perLossLiquidValue = HogaSummitSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutSquareOcc)
            {
                enableTotalProfitLiquid = CallPutSquareOccSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = CallPutSquareOccSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = CallPutSquareOccSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = CallPutSquareOccSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = CallPutSquareOccSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = CallPutSquareOccSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = CallPutSquareOccSysVar.PerProfitLiquidValue;
                perLossLiquidValue = CallPutSquareOccSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypePureHogaSummit)
            {
                enableTotalProfitLiquid = PureHogaSummitSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = PureHogaSummitSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = PureHogaSummitSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = PureHogaSummitSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = PureHogaSummitSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = PureHogaSummitSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = PureHogaSummitSysVar.PerProfitLiquidValue;
                perLossLiquidValue = PureHogaSummitSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeLooseHogaSummit)
            {
                enableTotalProfitLiquid = LooseHogaSummitSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = LooseHogaSummitSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = LooseHogaSummitSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = LooseHogaSummitSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = LooseHogaSummitSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = LooseHogaSummitSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = LooseHogaSummitSysVar.PerProfitLiquidValue;
                perLossLiquidValue = LooseHogaSummitSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutInvDiv)
            {
                enableTotalProfitLiquid = CallPutInvDivSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = CallPutInvDivSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = CallPutInvDivSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = CallPutInvDivSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = CallPutInvDivSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = CallPutInvDivSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = CallPutInvDivSysVar.PerProfitLiquidValue;
                perLossLiquidValue = CallPutInvDivSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeTipAttack)
            {
                enableTotalProfitLiquid = TipAttackSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = TipAttackSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = TipAttackSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = TipAttackSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = TipAttackSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = TipAttackSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = TipAttackSysVar.PerProfitLiquidValue;
                perLossLiquidValue = TipAttackSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeOptPrice)
            {
                enableTotalProfitLiquid = OptPriceSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = OptPriceSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = OptPriceSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = OptPriceSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = OptPriceSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = OptPriceSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = OptPriceSysVar.PerProfitLiquidValue;
                perLossLiquidValue = OptPriceSysVar.PerLossLiquidValue;
            }

            if (enablePerProfitLiquid == true)
            {
                if (curProfit > 0 && curProfit > perProfitLiquidValue)
                {
                    m_TotalSigMan.SetSignalInfo(m_PriceStateList.Count, signalVal, GlobalVar.SignalStateLiquid, ref m_CurState);
                    m_TotalSigMan.WriteSignalLog("1회 이익 제한으로 청산신호 발생", m_LogFileName, m_CurState);
                    return m_CurState;
                }
            }

            if (enablePerLossLiquid == true)
            {
                if (curProfit < 0 && curProfit < -perLossLiquidValue)
                {
                    m_TotalSigMan.SetSignalInfo(m_PriceStateList.Count, signalVal, GlobalVar.SignalStateLiquid, ref m_CurState);
                    m_TotalSigMan.WriteSignalLog("1회손실 제한으로 청산신호 발생", m_LogFileName, m_CurState);
                    return m_CurState;
                }
            }

            return null;
        }

        // 값에 의한 청산에 의하여 청산 신호를 발생시킨다.
        protected EasyTrader.Signal.PriceSignal GetLiquidSignalByTotalPrice()
        {
            EasyTrader.Signal.PriceSignal lastSignal = m_TotalSigMan.GetLastSignal(m_PriceSignalList);
            if (lastSignal == null || lastSignal.Type == GlobalVar.SignalExitBuy || lastSignal.Type == GlobalVar.SignalExitSell)
                return null;

            double curVal = m_TotalSigMan.CurVal;
            // 현재 값이 설정되어 있지 않을 때는 아무일도 하지 않는다.
            if (curVal == 0.0)
                return null;
            double curProfit = m_TotalSigMan.CalcCurProfit(m_PriceSignalList, curVal);
            double totalProfit = m_TotalSigMan.CalcTotalProfit(m_PriceSignalList, curVal);
            int signalVal = GlobalVar.SignalNone;
            if (lastSignal.Type == GlobalVar.SignalBuy)
                signalVal = GlobalVar.SignalExitBuy;
            else if (lastSignal.Type == GlobalVar.SignalSell)
                signalVal = GlobalVar.SignalExitSell;

            bool enableTotalProfitLiquid = false;
            bool enableTotalLossLiquid = false;
            bool enablePerProfitLiquid = false;
            bool enablePerLossLiquid = false;
            double totalProfitLiquidValue = 0.0;
            double totalLossLiquidValue = 0.0;
            double perProfitLiquidValue = 0.0;
            double perLossLiquidValue = 0.0;

            if (m_SysType == GlobalVar.SysTypeJisuWaveHogaSummit)
            {
                enableTotalProfitLiquid = JisuWaveHogaSummitSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = JisuWaveHogaSummitSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = JisuWaveHogaSummitSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = JisuWaveHogaSummitSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = JisuWaveHogaSummitSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = JisuWaveHogaSummitSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = JisuWaveHogaSummitSysVar.PerProfitLiquidValue;
                perLossLiquidValue = JisuWaveHogaSummitSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeJisuWave)
            {
                enableTotalProfitLiquid = JisuWaveSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = JisuWaveSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = JisuWaveSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = JisuWaveSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = JisuWaveSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = JisuWaveSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = JisuWaveSysVar.PerProfitLiquidValue;
                perLossLiquidValue = JisuWaveSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaWave)
            {
                enableTotalProfitLiquid = HogaWaveSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = HogaWaveSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = HogaWaveSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = HogaWaveSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = HogaWaveSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = HogaWaveSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = HogaWaveSysVar.PerProfitLiquidValue;
                perLossLiquidValue = HogaWaveSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSquareOcc)
            {
                enableTotalProfitLiquid = HogaSquareOccSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = HogaSquareOccSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = HogaSquareOccSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = HogaSquareOccSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = HogaSquareOccSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = HogaSquareOccSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = HogaSquareOccSysVar.PerProfitLiquidValue;
                perLossLiquidValue = HogaSquareOccSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSummit)
            {
                enableTotalProfitLiquid = HogaSummitSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = HogaSummitSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = HogaSummitSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = HogaSummitSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = HogaSummitSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = HogaSummitSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = HogaSummitSysVar.PerProfitLiquidValue;
                perLossLiquidValue = HogaSummitSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutSquareOcc)
            {
                enableTotalProfitLiquid = CallPutSquareOccSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = CallPutSquareOccSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = CallPutSquareOccSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = CallPutSquareOccSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = CallPutSquareOccSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = CallPutSquareOccSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = CallPutSquareOccSysVar.PerProfitLiquidValue;
                perLossLiquidValue = CallPutSquareOccSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypePureHogaSummit)
            {
                enableTotalProfitLiquid = PureHogaSummitSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = PureHogaSummitSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = PureHogaSummitSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = PureHogaSummitSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = PureHogaSummitSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = PureHogaSummitSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = PureHogaSummitSysVar.PerProfitLiquidValue;
                perLossLiquidValue = PureHogaSummitSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeLooseHogaSummit)
            {
                enableTotalProfitLiquid = LooseHogaSummitSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = LooseHogaSummitSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = LooseHogaSummitSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = LooseHogaSummitSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = LooseHogaSummitSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = LooseHogaSummitSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = LooseHogaSummitSysVar.PerProfitLiquidValue;
                perLossLiquidValue = LooseHogaSummitSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutInvDiv)
            {
                enableTotalProfitLiquid = CallPutInvDivSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = CallPutInvDivSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = CallPutInvDivSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = CallPutInvDivSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = CallPutInvDivSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = CallPutInvDivSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = CallPutInvDivSysVar.PerProfitLiquidValue;
                perLossLiquidValue = CallPutInvDivSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeTipAttack)
            {
                enableTotalProfitLiquid = TipAttackSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = TipAttackSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = TipAttackSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = TipAttackSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = TipAttackSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = TipAttackSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = TipAttackSysVar.PerProfitLiquidValue;
                perLossLiquidValue = TipAttackSysVar.PerLossLiquidValue;
            }
            else if (m_SysType == GlobalVar.SysTypeOptPrice)
            {
                enableTotalProfitLiquid = OptPriceSysVar.EnableTotalProfitLiquid;
                enableTotalLossLiquid = OptPriceSysVar.EnableTotalLossLiquid;
                enablePerProfitLiquid = OptPriceSysVar.EnablePerProfitLiquid;
                enablePerLossLiquid = OptPriceSysVar.EnablePerLossLiquid;
                totalProfitLiquidValue = OptPriceSysVar.TotalProfitLiquidValue;
                totalLossLiquidValue = OptPriceSysVar.TotalLossLiquidValue;
                perProfitLiquidValue = OptPriceSysVar.PerProfitLiquidValue;
                perLossLiquidValue = OptPriceSysVar.PerLossLiquidValue;
            }


            // 가장 먼저 청산을 확인 한다. 개별 청산, 전체 청산을 고려한다.
            if (enableTotalProfitLiquid == true)
            {
                if (totalProfit > 0 && totalProfit > totalProfitLiquidValue)
                {
                    m_TotalSigMan.SetSignalInfo(m_PriceStateList.Count, signalVal, GlobalVar.SignalStateLiquid, ref m_CurState);
                    m_TotalSigMan.WriteSignalLog("최대이익 제한으로 청산신호 발생", m_LogFileName, m_CurState);
                    return m_CurState;
                }
            }

            if (enableTotalLossLiquid == true)
            {
                if (totalProfit < 0 && totalProfit < -totalLossLiquidValue)
                {
                    m_TotalSigMan.SetSignalInfo(m_PriceStateList.Count, signalVal, GlobalVar.SignalStateLiquid, ref m_CurState);
                    m_TotalSigMan.WriteSignalLog("최대손실 제한으로 청산신호 발생", m_LogFileName, m_CurState);
                    return m_CurState;
                }
            }

            return null;
        }


        protected EasyTrader.Signal.PriceSignal GetLiquidSignalByMaxPrice()
        {
            EasyTrader.Signal.PriceSignal lastSignal = m_TotalSigMan.GetLastSignal(m_PriceSignalList);
            if (lastSignal == null || lastSignal.Type == GlobalVar.SignalExitBuy || lastSignal.Type == GlobalVar.SignalExitSell)
                return null;

            double curVal = m_TotalSigMan.CurVal;
            // 현재 값이 설정되어 있지 않을 때는 아무일도 하지 않는다.
            if (curVal == 0.0)
                return null;
            double totalProfit = m_TotalSigMan.CalcTotalProfit(m_PriceSignalList, curVal);
            int signalVal = GlobalVar.SignalNone;
            if (lastSignal.Type == GlobalVar.SignalBuy)
                signalVal = GlobalVar.SignalExitBuy;
            else if (lastSignal.Type == GlobalVar.SignalSell)
                signalVal = GlobalVar.SignalExitSell;

            bool enableProfitTrailStop = false;
            double maxProfit = 0.0;
            double limitProfit = 0.0;
            double minProfit = 0.0;

            if (m_SysType == GlobalVar.SysTypeJisuWaveHogaSummit)
            {
                enableProfitTrailStop = JisuWaveHogaSummitSysVar.EnableProfitTrailStop;
                if (totalProfit > JisuWaveHogaSummitSysVar.MaxProfit)
                    JisuWaveHogaSummitSysVar.MaxProfit = totalProfit;
                maxProfit = JisuWaveHogaSummitSysVar.MaxProfit;
                limitProfit = JisuWaveHogaSummitSysVar.MaxProfitLiquidVal;
                minProfit = JisuWaveHogaSummitSysVar.MinProfit;
            }
            else if (m_SysType == GlobalVar.SysTypeJisuWave)
            {
                enableProfitTrailStop = JisuWaveSysVar.EnableProfitTrailStop;
                if (totalProfit > JisuWaveSysVar.MaxProfit)
                    JisuWaveSysVar.MaxProfit = totalProfit;
                maxProfit = JisuWaveSysVar.MaxProfit;
                limitProfit = JisuWaveSysVar.MaxProfitLiquidVal;
                minProfit = JisuWaveSysVar.MinProfit;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaWave)
            {
                enableProfitTrailStop = HogaWaveSysVar.EnableProfitTrailStop;
                if (totalProfit > HogaWaveSysVar.MaxProfit)
                    HogaWaveSysVar.MaxProfit = totalProfit;
                maxProfit = HogaWaveSysVar.MaxProfit;
                limitProfit = HogaWaveSysVar.MaxProfitLiquidVal;
                minProfit = HogaWaveSysVar.MinProfit;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSquareOcc)
            {
                enableProfitTrailStop = HogaSquareOccSysVar.EnableProfitTrailStop;
                if (totalProfit > HogaSquareOccSysVar.MaxProfit)
                    HogaSquareOccSysVar.MaxProfit = totalProfit;
                maxProfit = HogaSquareOccSysVar.MaxProfit;
                limitProfit = HogaSquareOccSysVar.MaxProfitLiquidVal;
                minProfit = HogaSquareOccSysVar.MinProfit;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSummit)
            {
                enableProfitTrailStop = HogaSummitSysVar.EnableProfitTrailStop;
                if (totalProfit > HogaSummitSysVar.MaxProfit)
                    HogaSummitSysVar.MaxProfit = totalProfit;
                maxProfit = HogaSummitSysVar.MaxProfit;
                limitProfit = HogaSummitSysVar.MaxProfitLiquidVal;
                minProfit = HogaSummitSysVar.MinProfit;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutSquareOcc)
            {
                enableProfitTrailStop = CallPutSquareOccSysVar.EnableProfitTrailStop;
                if (totalProfit > CallPutSquareOccSysVar.MaxProfit)
                    CallPutSquareOccSysVar.MaxProfit = totalProfit;
                maxProfit = CallPutSquareOccSysVar.MaxProfit;
                limitProfit = CallPutSquareOccSysVar.MaxProfitLiquidVal;
                minProfit = CallPutSquareOccSysVar.MinProfit;
            }
            else if (m_SysType == GlobalVar.SysTypePureHogaSummit)
            {
                enableProfitTrailStop = PureHogaSummitSysVar.EnableProfitTrailStop;
                if (totalProfit > PureHogaSummitSysVar.MaxProfit)
                    PureHogaSummitSysVar.MaxProfit = totalProfit;
                maxProfit = PureHogaSummitSysVar.MaxProfit;
                limitProfit = PureHogaSummitSysVar.MaxProfitLiquidVal;
                minProfit = PureHogaSummitSysVar.MinProfit;
            }
            else if (m_SysType == GlobalVar.SysTypeLooseHogaSummit)
            {
                enableProfitTrailStop = LooseHogaSummitSysVar.EnableProfitTrailStop;
                if (totalProfit > LooseHogaSummitSysVar.MaxProfit)
                    LooseHogaSummitSysVar.MaxProfit = totalProfit;
                maxProfit = LooseHogaSummitSysVar.MaxProfit;
                limitProfit = LooseHogaSummitSysVar.MaxProfitLiquidVal;
                minProfit = LooseHogaSummitSysVar.MinProfit;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutInvDiv)
            {
                enableProfitTrailStop = CallPutInvDivSysVar.EnableProfitTrailStop;
                if (totalProfit > CallPutInvDivSysVar.MaxProfit)
                    CallPutInvDivSysVar.MaxProfit = totalProfit;
                maxProfit = CallPutInvDivSysVar.MaxProfit;
                limitProfit = CallPutInvDivSysVar.MaxProfitLiquidVal;
                minProfit = CallPutInvDivSysVar.MinProfit;
            }
            else if (m_SysType == GlobalVar.SysTypeTipAttack)
            {
                enableProfitTrailStop = TipAttackSysVar.EnableProfitTrailStop;
                if (totalProfit > TipAttackSysVar.MaxProfit)
                    TipAttackSysVar.MaxProfit = totalProfit;
                maxProfit = TipAttackSysVar.MaxProfit;
                limitProfit = TipAttackSysVar.MaxProfitLiquidVal;
                minProfit = TipAttackSysVar.MinProfit;
            }
            else if (m_SysType == GlobalVar.SysTypeOptPrice)
            {
                enableProfitTrailStop = OptPriceSysVar.EnableProfitTrailStop;
                if (totalProfit > OptPriceSysVar.MaxProfit)
                    OptPriceSysVar.MaxProfit = totalProfit;
                maxProfit = OptPriceSysVar.MaxProfit;
                limitProfit = OptPriceSysVar.MaxProfitLiquidVal;
                minProfit = OptPriceSysVar.MinProfit;
            }


            // 가장 먼저 청산을 확인 한다. 개별 청산, 전체 청산을 고려한다.
            if (enableProfitTrailStop == true)
            {
                double deltaProfit = maxProfit - totalProfit;
                if (maxProfit > minProfit && deltaProfit > limitProfit)
                {
                    m_TotalSigMan.SetSignalInfo(m_PriceStateList.Count, signalVal, GlobalVar.SignalStateLiquid, ref m_CurState);
                    m_TotalSigMan.WriteSignalLog("최대이익 감소로 청산신호 발생", m_LogFileName, m_CurState);
                    return m_CurState;
                }
            }
            return null;
        }


        // 값에 의한 청산에 의하여 청산 신호를 발생시킨다.
        protected EasyTrader.Signal.PriceSignal GetLiquidSignalByTotalPriceStepByStep()
        {
            EasyTrader.Signal.PriceSignal lastSignal = m_TotalSigMan.GetLastSignal(m_PriceSignalList);
            if (lastSignal == null || lastSignal.Type == GlobalVar.SignalExitBuy || lastSignal.Type == GlobalVar.SignalExitSell)
                return null;

            double curVal = m_TotalSigMan.CurVal;
            // 현재 값이 설정되어 있지 않을 때는 아무일도 하지 않는다.
            if (curVal == 0.0)
                return null;
            double totalProfit = m_TotalSigMan.CalcTotalProfit(m_PriceSignalList, curVal);
            int signalVal = GlobalVar.SignalNone;
            if (lastSignal.Type == GlobalVar.SignalBuy)
                signalVal = GlobalVar.SignalBuyPartialLiquid;
            else if (lastSignal.Type == GlobalVar.SignalSell)
                signalVal = GlobalVar.SignalSellPartialLiquid;

            bool enableTotalProfitStepLiquid = false;
            double totalProfitStepLiquidVal = 0.0;

            if (m_SysType == GlobalVar.SysTypeJisuWaveHogaSummit)
            {
                enableTotalProfitStepLiquid = JisuWaveHogaSummitSysVar.EnableTotalProfitStepLiquid;
                totalProfitStepLiquidVal = JisuWaveHogaSummitSysVar.TotalProfitStepLiquidVal;
            }
            else if (m_SysType == GlobalVar.SysTypeJisuWave)
            {
                enableTotalProfitStepLiquid = JisuWaveSysVar.EnableTotalProfitStepLiquid;
                totalProfitStepLiquidVal = JisuWaveSysVar.TotalProfitStepLiquidVal;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaWave)
            {
                enableTotalProfitStepLiquid = HogaWaveSysVar.EnableTotalProfitStepLiquid;
                totalProfitStepLiquidVal = HogaWaveSysVar.TotalProfitStepLiquidVal;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSquareOcc)
            {
                enableTotalProfitStepLiquid = HogaSquareOccSysVar.EnableTotalProfitStepLiquid;
                totalProfitStepLiquidVal = HogaSquareOccSysVar.TotalProfitStepLiquidVal;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSummit)
            {
                enableTotalProfitStepLiquid = HogaSummitSysVar.EnableTotalProfitStepLiquid;
                totalProfitStepLiquidVal = HogaSummitSysVar.TotalProfitStepLiquidVal;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutSquareOcc)
            {
                enableTotalProfitStepLiquid = CallPutSquareOccSysVar.EnableTotalProfitStepLiquid;
                totalProfitStepLiquidVal = CallPutSquareOccSysVar.TotalProfitStepLiquidVal;
            }
            else if (m_SysType == GlobalVar.SysTypePureHogaSummit)
            {
                enableTotalProfitStepLiquid = PureHogaSummitSysVar.EnableTotalProfitStepLiquid;
                totalProfitStepLiquidVal = PureHogaSummitSysVar.TotalProfitStepLiquidVal;
            }
            else if (m_SysType == GlobalVar.SysTypeLooseHogaSummit)
            {
                enableTotalProfitStepLiquid = LooseHogaSummitSysVar.EnableTotalProfitStepLiquid;
                totalProfitStepLiquidVal = LooseHogaSummitSysVar.TotalProfitStepLiquidVal;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutInvDiv)
            {
                enableTotalProfitStepLiquid = CallPutInvDivSysVar.EnableTotalProfitStepLiquid;
                totalProfitStepLiquidVal = CallPutInvDivSysVar.TotalProfitStepLiquidVal;
            }
            else if (m_SysType == GlobalVar.SysTypeTipAttack)
            {
                enableTotalProfitStepLiquid = TipAttackSysVar.EnableTotalProfitStepLiquid;
                totalProfitStepLiquidVal = TipAttackSysVar.TotalProfitStepLiquidVal;
            }
            else if (m_SysType == GlobalVar.SysTypeOptPrice)
            {
                enableTotalProfitStepLiquid = OptPriceSysVar.EnableTotalProfitStepLiquid;
                totalProfitStepLiquidVal = OptPriceSysVar.TotalProfitStepLiquidVal;
            }


            // 가장 먼저 청산을 확인 한다. 개별 청산, 전체 청산을 고려한다.
            if (enableTotalProfitStepLiquid == true)
            {
                if (totalProfit > 0 && totalProfit > totalProfitStepLiquidVal)
                {
                    m_TotalSigMan.SetSignalInfo(m_PriceStateList.Count, signalVal, GlobalVar.SignalStateLiquid, ref m_CurState);
                    m_TotalSigMan.WriteSignalLog("최대이익에 의한 단계별 청산신호 발생", m_LogFileName, m_CurState);
                    return m_CurState;
                }
            }

            return null;
        }

        protected EasyTrader.Signal.PriceSignal GetLiquidSignalByStateCountStepByStep()
        {
            EasyTrader.Signal.PriceSignal lastSignal = m_TotalSigMan.GetLastSignal(m_PriceSignalList);
            if (lastSignal == null || lastSignal.Type == GlobalVar.SignalExitBuy || lastSignal.Type == GlobalVar.SignalExitSell)
                return null;

            double curVal = m_TotalSigMan.CurVal;
            // 현재 값이 설정되어 있지 않을 때는 아무일도 하지 않는다.
            if (curVal == 0.0)
                return null;
            int stateCount = m_PriceStateList.Count;
            int signalVal = GlobalVar.SignalNone;
            if (lastSignal.Type == GlobalVar.SignalBuy)
                signalVal = GlobalVar.SignalBuyPartialLiquid;
            else if (lastSignal.Type == GlobalVar.SignalSell)
                signalVal = GlobalVar.SignalSellPartialLiquid;

            bool enableStateCountStepLiquid = false;
            int stepLiquidStateCount = 0;
            if (m_SysType == GlobalVar.SysTypeJisuWaveHogaSummit)
            {
                enableStateCountStepLiquid = JisuWaveHogaSummitSysVar.EnableStateCountStepLiquid;
                stepLiquidStateCount = JisuWaveHogaSummitSysVar.StepLiquidStateCount;
            }
            else if (m_SysType == GlobalVar.SysTypeJisuWave)
            {
                enableStateCountStepLiquid = JisuWaveSysVar.EnableStateCountStepLiquid;
                stepLiquidStateCount = JisuWaveSysVar.StepLiquidStateCount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaWave)
            {
                enableStateCountStepLiquid = HogaWaveSysVar.EnableStateCountStepLiquid;
                stepLiquidStateCount = HogaWaveSysVar.StepLiquidStateCount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSquareOcc)
            {
                enableStateCountStepLiquid = HogaSquareOccSysVar.EnableStateCountStepLiquid;
                stepLiquidStateCount = HogaSquareOccSysVar.StepLiquidStateCount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSummit)
            {
                enableStateCountStepLiquid = HogaSummitSysVar.EnableStateCountStepLiquid;
                stepLiquidStateCount = HogaSummitSysVar.StepLiquidStateCount;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutSquareOcc)
            {
                enableStateCountStepLiquid = CallPutSquareOccSysVar.EnableStateCountStepLiquid;
                stepLiquidStateCount = CallPutSquareOccSysVar.StepLiquidStateCount;
            }
            else if (m_SysType == GlobalVar.SysTypePureHogaSummit)
            {
                enableStateCountStepLiquid = PureHogaSummitSysVar.EnableStateCountStepLiquid;
                stepLiquidStateCount = PureHogaSummitSysVar.StepLiquidStateCount;
            }
            else if (m_SysType == GlobalVar.SysTypeLooseHogaSummit)
            {
                enableStateCountStepLiquid = LooseHogaSummitSysVar.EnableStateCountStepLiquid;
                stepLiquidStateCount = LooseHogaSummitSysVar.StepLiquidStateCount;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutInvDiv)
            {
                enableStateCountStepLiquid = CallPutInvDivSysVar.EnableStateCountStepLiquid;
                stepLiquidStateCount = CallPutInvDivSysVar.StepLiquidStateCount;
            }
            else if (m_SysType == GlobalVar.SysTypeTipAttack)
            {
                enableStateCountStepLiquid = TipAttackSysVar.EnableStateCountStepLiquid;
                stepLiquidStateCount = TipAttackSysVar.StepLiquidStateCount;
            }
            else if (m_SysType == GlobalVar.SysTypeOptPrice)
            {
                enableStateCountStepLiquid = OptPriceSysVar.EnableStateCountStepLiquid;
                stepLiquidStateCount = OptPriceSysVar.StepLiquidStateCount;
            }


            // 가장 먼저 청산을 확인 한다. 개별 청산, 전체 청산을 고려한다.
            if (enableStateCountStepLiquid == true)
            {
                if (stateCount > 1 && stateCount > stepLiquidStateCount)
                {
                    m_TotalSigMan.SetSignalInfo(m_PriceStateList.Count, signalVal, GlobalVar.SignalStateLiquid, ref m_CurState);
                    m_TotalSigMan.WriteSignalLog("상태 개수에 의한 단계별 청산신호 발생", m_LogFileName, m_CurState);
                    return m_CurState;
                }
            }

            return null;
        }

        // 시간 제한에 의하여 청산 신호를 발생시킨다.
        protected EasyTrader.Signal.PriceSignal GetLiquidSignalByTime()
        {
            EasyTrader.Signal.PriceSignal lastSignal = m_TotalSigMan.GetLastSignal(m_PriceSignalList);
            if (lastSignal == null || lastSignal.Type == GlobalVar.SignalExitBuy || lastSignal.Type == GlobalVar.SignalExitSell)
                return null;

            int signalVal = GlobalVar.SignalNone;
            if (lastSignal.Type == GlobalVar.SignalBuy)
                signalVal = GlobalVar.SignalExitBuy;
            else if (lastSignal.Type == GlobalVar.SignalSell)
                signalVal = GlobalVar.SignalExitSell;

            int sysEndHour = 0;
            int sysEndMin = 0;
            if (m_SysType == GlobalVar.SysTypeJisuWaveHogaSummit)
            {
                sysEndHour = JisuWaveHogaSummitSysVar.SysEndHour;
                sysEndMin = JisuWaveHogaSummitSysVar.SysEndMin;
            }
            else if (m_SysType == GlobalVar.SysTypeJisuWave)
            {
                sysEndHour = JisuWaveSysVar.SysEndHour;
                sysEndMin = JisuWaveSysVar.SysEndMin;
             }
            else if (m_SysType == GlobalVar.SysTypeHogaWave)
            {
                sysEndHour = HogaWaveSysVar.SysEndHour;
                sysEndMin = HogaWaveSysVar.SysEndMin;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSquareOcc)
            {
                sysEndHour = HogaSquareOccSysVar.SysEndHour;
                sysEndMin = HogaSquareOccSysVar.SysEndMin;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSummit)
            {
                sysEndHour = HogaSummitSysVar.SysEndHour;
                sysEndMin = HogaSummitSysVar.SysEndMin;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutSquareOcc)
            {
                sysEndHour = CallPutSquareOccSysVar.SysEndHour;
                sysEndMin = CallPutSquareOccSysVar.SysEndMin;
            }
            else if (m_SysType == GlobalVar.SysTypePureHogaSummit)
            {
                sysEndHour = PureHogaSummitSysVar.SysEndHour;
                sysEndMin = PureHogaSummitSysVar.SysEndMin;
            }
            else if (m_SysType == GlobalVar.SysTypeLooseHogaSummit)
            {
                sysEndHour = LooseHogaSummitSysVar.SysEndHour;
                sysEndMin = LooseHogaSummitSysVar.SysEndMin;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutInvDiv)
            {
                sysEndHour = CallPutInvDivSysVar.SysEndHour;
                sysEndMin = CallPutInvDivSysVar.SysEndMin;
            }
            else if (m_SysType == GlobalVar.SysTypeTipAttack)
            {
                sysEndHour = TipAttackSysVar.SysEndHour;
                sysEndMin = TipAttackSysVar.SysEndMin;
            }
            else if (m_SysType == GlobalVar.SysTypeOptPrice)
            {
                sysEndHour = OptPriceSysVar.SysEndHour;
                sysEndMin = OptPriceSysVar.SysEndMin;
            }

            int curTime = GlobalVar.TimeToInt();
            if (GlobalVar.OperationMode == GlobalVar.OperationModeSimul)
            {
                curTime = GlobalVar.DayIndexToTime(m_TotalSigMan.CurIndex);
            }
            if (curTime == GlobalVar.TimeToInt(sysEndHour, sysEndMin))
            {
                m_TotalSigMan.SetSignalInfo(m_PriceStateList.Count, signalVal, GlobalVar.SignalStateLiquid, ref m_CurState);
                m_TotalSigMan.WriteSignalLog(" 시간제한에 의한 청산신호 발생", m_LogFileName, m_CurState);
                return m_CurState;
            }

            return null;
        }

        // 상태 개수 제한에 의하여 신호를 발생시킨다.
        protected EasyTrader.Signal.PriceSignal GetLiquidSignalByStateCount()
        {
            EasyTrader.Signal.PriceSignal lastSignal = m_TotalSigMan.GetLastSignal(m_PriceSignalList);
            if (lastSignal == null || lastSignal.Type == GlobalVar.SignalExitBuy || lastSignal.Type == GlobalVar.SignalExitSell)
                return null;

            int signalVal = GlobalVar.SignalNone;
            if (lastSignal.Type == GlobalVar.SignalBuy)
                signalVal = GlobalVar.SignalExitBuy;
            else if (lastSignal.Type == GlobalVar.SignalSell)
                signalVal = GlobalVar.SignalExitSell;

            int sysEndState = 0;
            if (m_SysType == GlobalVar.SysTypeJisuWaveHogaSummit)
            {
                sysEndState = JisuWaveHogaSummitSysVar.SysEndState;
            }
            else if (m_SysType == GlobalVar.SysTypeJisuWave)
            {
                sysEndState = JisuWaveSysVar.SysEndState;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaWave)
            {
                sysEndState = HogaWaveSysVar.SysEndState;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSquareOcc)
            {
                sysEndState = HogaSquareOccSysVar.SysEndState;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSummit)
            {
                sysEndState = HogaSummitSysVar.SysEndState;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutSquareOcc)
            {
                sysEndState = CallPutSquareOccSysVar.SysEndState;
            }
            else if (m_SysType == GlobalVar.SysTypePureHogaSummit)
            {
                sysEndState = PureHogaSummitSysVar.SysEndState;
            }
            else if (m_SysType == GlobalVar.SysTypeLooseHogaSummit)
            {
                sysEndState = LooseHogaSummitSysVar.SysEndState;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutInvDiv)
            {
                sysEndState = CallPutInvDivSysVar.SysEndState;
            }
            else if (m_SysType == GlobalVar.SysTypeTipAttack)
            {
                sysEndState = TipAttackSysVar.SysEndState;
            }
            else if (m_SysType == GlobalVar.SysTypeOptPrice)
            {
                sysEndState = OptPriceSysVar.SysEndState;
            }
            int stateCount = m_PriceStateList.Count;
            if (stateCount == sysEndState)
            {
                m_TotalSigMan.SetSignalInfo(m_PriceStateList.Count, signalVal, GlobalVar.SignalStateLiquid, ref m_CurState);
                m_TotalSigMan.WriteSignalLog("최대상태 개수 제한에 의한 청산신호 발생", m_LogFileName, m_CurState);
                return m_CurState;
            }

            return null;
        }


        protected void SendLiquidOrder(EasyTrader.Signal.PriceSignal a_Signal)
        {
            if (m_OrderMan == null || a_Signal == null)
                return;

            bool AutoOrder = GlobalVar.AutoOrder;
            int OrderStartHour = GlobalVar.OrderStartHour;
            int OrderStartMin = GlobalVar.OrderStartMin;
            int OrderEndHour = GlobalVar.OrderEndHour;
            int OrderEndMin = GlobalVar.OrderEndMin;
            int OrderStartSignal = 1;
            int OrderEndSignal = 50;
            int PerLiquidOrderAmount = 1;

            if (m_SysType == GlobalVar.SysTypeJisuWaveHogaSummit)
            {
                AutoOrder = JisuWaveHogaSummitSysVar.AutoOrder;
                OrderStartHour = JisuWaveHogaSummitSysVar.OrderStartHour;
                OrderStartMin = JisuWaveHogaSummitSysVar.OrderStartMin;
                OrderEndHour = JisuWaveHogaSummitSysVar.OrderEndHour;
                OrderEndMin = JisuWaveHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = JisuWaveHogaSummitSysVar.SysStartState;
                OrderEndSignal = JisuWaveHogaSummitSysVar.SysEndState;
                PerLiquidOrderAmount = JisuWaveHogaSummitSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaWave)
            {
                AutoOrder = HogaWaveSysVar.AutoOrder;
                OrderStartHour = HogaWaveSysVar.OrderStartHour;
                OrderStartMin = HogaWaveSysVar.OrderStartMin;
                OrderEndHour = HogaWaveSysVar.OrderEndHour;
                OrderEndMin = HogaWaveSysVar.OrderEndMin;
                OrderStartSignal = HogaWaveSysVar.SysStartState;
                OrderEndSignal = HogaWaveSysVar.SysEndState;
                PerLiquidOrderAmount = HogaWaveSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeJisuWave)
            {
                AutoOrder = JisuWaveSysVar.AutoOrder;
                OrderStartHour = JisuWaveSysVar.OrderStartHour;
                OrderStartMin = JisuWaveSysVar.OrderStartMin;
                OrderEndHour = JisuWaveSysVar.OrderEndHour;
                OrderEndMin = JisuWaveSysVar.OrderEndMin;
                OrderStartSignal = JisuWaveSysVar.SysStartState;
                OrderEndSignal = JisuWaveSysVar.SysEndState;
                PerLiquidOrderAmount = JisuWaveSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSquareOcc)
            {
                AutoOrder = HogaSquareOccSysVar.AutoOrder;
                OrderStartHour = HogaSquareOccSysVar.OrderStartHour;
                OrderStartMin = HogaSquareOccSysVar.OrderStartMin;
                OrderEndHour = HogaSquareOccSysVar.OrderEndHour;
                OrderEndMin = HogaSquareOccSysVar.OrderEndMin;
                OrderStartSignal = HogaSquareOccSysVar.SysStartState;
                OrderEndSignal = HogaSquareOccSysVar.SysEndState;
                PerLiquidOrderAmount = HogaSquareOccSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSummit)
            {
                AutoOrder = HogaSummitSysVar.AutoOrder;
                OrderStartHour = HogaSummitSysVar.OrderStartHour;
                OrderStartMin = HogaSummitSysVar.OrderStartMin;
                OrderEndHour = HogaSummitSysVar.OrderEndHour;
                OrderEndMin = HogaSummitSysVar.OrderEndMin;
                OrderStartSignal = HogaSummitSysVar.SysStartState;
                OrderEndSignal = HogaSummitSysVar.SysEndState;
                PerLiquidOrderAmount = HogaSummitSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutSquareOcc)
            {
                AutoOrder = CallPutSquareOccSysVar.AutoOrder;
                OrderStartHour = CallPutSquareOccSysVar.OrderStartHour;
                OrderStartMin = CallPutSquareOccSysVar.OrderStartMin;
                OrderEndHour = CallPutSquareOccSysVar.OrderEndHour;
                OrderEndMin = CallPutSquareOccSysVar.OrderEndMin;
                OrderStartSignal = CallPutSquareOccSysVar.SysStartState;
                OrderEndSignal = CallPutSquareOccSysVar.SysEndState;
                PerLiquidOrderAmount = CallPutSquareOccSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypePureHogaSummit)
            {
                AutoOrder = PureHogaSummitSysVar.AutoOrder;
                OrderStartHour = PureHogaSummitSysVar.OrderStartHour;
                OrderStartMin = PureHogaSummitSysVar.OrderStartMin;
                OrderEndHour = PureHogaSummitSysVar.OrderEndHour;
                OrderEndMin = PureHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = PureHogaSummitSysVar.SysStartState;
                OrderEndSignal = PureHogaSummitSysVar.SysEndState;
                PerLiquidOrderAmount = PureHogaSummitSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeLooseHogaSummit)
            {
                AutoOrder = LooseHogaSummitSysVar.AutoOrder;
                OrderStartHour = LooseHogaSummitSysVar.OrderStartHour;
                OrderStartMin = LooseHogaSummitSysVar.OrderStartMin;
                OrderEndHour = LooseHogaSummitSysVar.OrderEndHour;
                OrderEndMin = LooseHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = LooseHogaSummitSysVar.SysStartState;
                OrderEndSignal = LooseHogaSummitSysVar.SysEndState;
                PerLiquidOrderAmount = LooseHogaSummitSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutInvDiv)
            {
                AutoOrder = CallPutInvDivSysVar.AutoOrder;
                OrderStartHour = CallPutInvDivSysVar.OrderStartHour;
                OrderStartMin = CallPutInvDivSysVar.OrderStartMin;
                OrderEndHour = CallPutInvDivSysVar.OrderEndHour;
                OrderEndMin = CallPutInvDivSysVar.OrderEndMin;
                OrderStartSignal = CallPutInvDivSysVar.SysStartState;
                OrderEndSignal = CallPutInvDivSysVar.SysEndState;
                PerLiquidOrderAmount = CallPutInvDivSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeTipAttack)
            {
                AutoOrder = TipAttackSysVar.AutoOrder;
                OrderStartHour = TipAttackSysVar.OrderStartHour;
                OrderStartMin = TipAttackSysVar.OrderStartMin;
                OrderEndHour = TipAttackSysVar.OrderEndHour;
                OrderEndMin = TipAttackSysVar.OrderEndMin;
                OrderStartSignal = TipAttackSysVar.SysStartState;
                OrderEndSignal = TipAttackSysVar.SysEndState;
                PerLiquidOrderAmount = TipAttackSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeOptPrice)
            {
                AutoOrder = OptPriceSysVar.AutoOrder;
                OrderStartHour = OptPriceSysVar.OrderStartHour;
                OrderStartMin = OptPriceSysVar.OrderStartMin;
                OrderEndHour = OptPriceSysVar.OrderEndHour;
                OrderEndMin = OptPriceSysVar.OrderEndMin;
                OrderStartSignal = OptPriceSysVar.SysStartState;
                OrderEndSignal = OptPriceSysVar.SysEndState;
                PerLiquidOrderAmount = OptPriceSysVar.PerLiquidOrderAmount;
            }

            // 자동 주문
            if (AutoOrder == true)
            {
                if (m_OrderMan.CanTakeAutoOrder(GlobalVar.TimeToInt(), OrderStartHour, OrderStartMin, OrderEndHour, OrderEndMin) == true)
                {
                    if (a_Signal.Type == GlobalVar.SignalSellLiquid)
                    {
                        m_OrderMan.SendLiquidOrder(PerLiquidOrderAmount, m_TotalSigMan.CurVal);
                        GlobalVar.PlaySignalBuySound();
                    }
                    else if (a_Signal.Type == GlobalVar.SignalBuyLiquid)
                    {
                        m_OrderMan.SendLiquidOrder(PerLiquidOrderAmount, m_TotalSigMan.CurVal);
                        GlobalVar.PlaySignalSellSound();
                    }
                }
            }
            else
            {
                if (a_Signal.Type == GlobalVar.SignalSellLiquid)
                {
                    GlobalVar.PlaySignalBuySound();
                    GlobalVar.SimulOrderMessage = "매수주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalBuyLiquid)
                {
                    GlobalVar.PlaySignalSellSound();
                    GlobalVar.SimulOrderMessage = "매도주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }

                if (GlobalVar.OperationMode == GlobalVar.OperationModeSimul && AutoOrder == true)
                {
                    Console.WriteLine(m_SysName + "주문나감" + m_TotalSigMan.CurVal.ToString("F2"));
                    return;
                }
            }
        }

        protected void SendLiquidOrder(EasyTrader.Signal.PriceSignal a_Signal, string a_Code)
        {
            if (m_OrderMan == null || a_Signal == null)
                return;

            bool AutoOrder = GlobalVar.AutoOrder;
            int OrderStartHour = GlobalVar.OrderStartHour;
            int OrderStartMin = GlobalVar.OrderStartMin;
            int OrderEndHour = GlobalVar.OrderEndHour;
            int OrderEndMin = GlobalVar.OrderEndMin;
            int OrderStartSignal = 1;
            int OrderEndSignal = 50;
            int PerLiquidOrderAmount = 1;

            if (m_SysType == GlobalVar.SysTypeJisuWaveHogaSummit)
            {
                AutoOrder = JisuWaveHogaSummitSysVar.AutoOrder;
                OrderStartHour = JisuWaveHogaSummitSysVar.OrderStartHour;
                OrderStartMin = JisuWaveHogaSummitSysVar.OrderStartMin;
                OrderEndHour = JisuWaveHogaSummitSysVar.OrderEndHour;
                OrderEndMin = JisuWaveHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = JisuWaveHogaSummitSysVar.SysStartState;
                OrderEndSignal = JisuWaveHogaSummitSysVar.SysEndState;
                PerLiquidOrderAmount = JisuWaveHogaSummitSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaWave)
            {
                AutoOrder = HogaWaveSysVar.AutoOrder;
                OrderStartHour = HogaWaveSysVar.OrderStartHour;
                OrderStartMin = HogaWaveSysVar.OrderStartMin;
                OrderEndHour = HogaWaveSysVar.OrderEndHour;
                OrderEndMin = HogaWaveSysVar.OrderEndMin;
                OrderStartSignal = HogaWaveSysVar.SysStartState;
                OrderEndSignal = HogaWaveSysVar.SysEndState;
                PerLiquidOrderAmount = HogaWaveSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeJisuWave)
            {
                AutoOrder = JisuWaveSysVar.AutoOrder;
                OrderStartHour = JisuWaveSysVar.OrderStartHour;
                OrderStartMin = JisuWaveSysVar.OrderStartMin;
                OrderEndHour = JisuWaveSysVar.OrderEndHour;
                OrderEndMin = JisuWaveSysVar.OrderEndMin;
                OrderStartSignal = JisuWaveSysVar.SysStartState;
                OrderEndSignal = JisuWaveSysVar.SysEndState;
                PerLiquidOrderAmount = JisuWaveSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSquareOcc)
            {
                AutoOrder = HogaSquareOccSysVar.AutoOrder;
                OrderStartHour = HogaSquareOccSysVar.OrderStartHour;
                OrderStartMin = HogaSquareOccSysVar.OrderStartMin;
                OrderEndHour = HogaSquareOccSysVar.OrderEndHour;
                OrderEndMin = HogaSquareOccSysVar.OrderEndMin;
                OrderStartSignal = HogaSquareOccSysVar.SysStartState;
                OrderEndSignal = HogaSquareOccSysVar.SysEndState;
                PerLiquidOrderAmount = HogaSquareOccSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSummit)
            {
                AutoOrder = HogaSummitSysVar.AutoOrder;
                OrderStartHour = HogaSummitSysVar.OrderStartHour;
                OrderStartMin = HogaSummitSysVar.OrderStartMin;
                OrderEndHour = HogaSummitSysVar.OrderEndHour;
                OrderEndMin = HogaSummitSysVar.OrderEndMin;
                OrderStartSignal = HogaSummitSysVar.SysStartState;
                OrderEndSignal = HogaSummitSysVar.SysEndState;
                PerLiquidOrderAmount = HogaSummitSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutSquareOcc)
            {
                AutoOrder = CallPutSquareOccSysVar.AutoOrder;
                OrderStartHour = CallPutSquareOccSysVar.OrderStartHour;
                OrderStartMin = CallPutSquareOccSysVar.OrderStartMin;
                OrderEndHour = CallPutSquareOccSysVar.OrderEndHour;
                OrderEndMin = CallPutSquareOccSysVar.OrderEndMin;
                OrderStartSignal = CallPutSquareOccSysVar.SysStartState;
                OrderEndSignal = CallPutSquareOccSysVar.SysEndState;
                PerLiquidOrderAmount = CallPutSquareOccSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypePureHogaSummit)
            {
                AutoOrder = PureHogaSummitSysVar.AutoOrder;
                OrderStartHour = PureHogaSummitSysVar.OrderStartHour;
                OrderStartMin = PureHogaSummitSysVar.OrderStartMin;
                OrderEndHour = PureHogaSummitSysVar.OrderEndHour;
                OrderEndMin = PureHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = PureHogaSummitSysVar.SysStartState;
                OrderEndSignal = PureHogaSummitSysVar.SysEndState;
                PerLiquidOrderAmount = PureHogaSummitSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeLooseHogaSummit)
            {
                AutoOrder = LooseHogaSummitSysVar.AutoOrder;
                OrderStartHour = LooseHogaSummitSysVar.OrderStartHour;
                OrderStartMin = LooseHogaSummitSysVar.OrderStartMin;
                OrderEndHour = LooseHogaSummitSysVar.OrderEndHour;
                OrderEndMin = LooseHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = LooseHogaSummitSysVar.SysStartState;
                OrderEndSignal = LooseHogaSummitSysVar.SysEndState;
                PerLiquidOrderAmount = LooseHogaSummitSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutInvDiv)
            {
                AutoOrder = CallPutInvDivSysVar.AutoOrder;
                OrderStartHour = CallPutInvDivSysVar.OrderStartHour;
                OrderStartMin = CallPutInvDivSysVar.OrderStartMin;
                OrderEndHour = CallPutInvDivSysVar.OrderEndHour;
                OrderEndMin = CallPutInvDivSysVar.OrderEndMin;
                OrderStartSignal = CallPutInvDivSysVar.SysStartState;
                OrderEndSignal = CallPutInvDivSysVar.SysEndState;
                PerLiquidOrderAmount = CallPutInvDivSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeTipAttack)
            {
                AutoOrder = TipAttackSysVar.AutoOrder;
                OrderStartHour = TipAttackSysVar.OrderStartHour;
                OrderStartMin = TipAttackSysVar.OrderStartMin;
                OrderEndHour = TipAttackSysVar.OrderEndHour;
                OrderEndMin = TipAttackSysVar.OrderEndMin;
                OrderStartSignal = TipAttackSysVar.SysStartState;
                OrderEndSignal = TipAttackSysVar.SysEndState;
                PerLiquidOrderAmount = TipAttackSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeOptPrice)
            {
                AutoOrder = OptPriceSysVar.AutoOrder;
                OrderStartHour = OptPriceSysVar.OrderStartHour;
                OrderStartMin = OptPriceSysVar.OrderStartMin;
                OrderEndHour = OptPriceSysVar.OrderEndHour;
                OrderEndMin = OptPriceSysVar.OrderEndMin;
                OrderStartSignal = OptPriceSysVar.SysStartState;
                OrderEndSignal = OptPriceSysVar.SysEndState;
                PerLiquidOrderAmount = OptPriceSysVar.PerLiquidOrderAmount;
            }

            // 자동 주문
            if (AutoOrder == true)
            {
                if (m_OrderMan.CanTakeAutoOrder(GlobalVar.TimeToInt(), OrderStartHour, OrderStartMin, OrderEndHour, OrderEndMin) == true)
                {
                    if (a_Signal.Type == GlobalVar.SignalSellLiquid)
                    {
                        m_OrderMan.SendLiquidOrder(PerLiquidOrderAmount, m_TotalSigMan.CurVal, a_Code);
                        GlobalVar.PlaySignalBuySound();
                    }
                    else if (a_Signal.Type == GlobalVar.SignalBuyLiquid)
                    {
                        m_OrderMan.SendLiquidOrder(PerLiquidOrderAmount, m_TotalSigMan.CurVal, a_Code);
                        GlobalVar.PlaySignalSellSound();
                    }
                }
            }
            else
            {
                if (a_Signal.Type == GlobalVar.SignalSellLiquid)
                {
                    GlobalVar.PlaySignalBuySound();
                    GlobalVar.SimulOrderMessage = "매수주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalBuyLiquid)
                {
                    GlobalVar.PlaySignalSellSound();
                    GlobalVar.SimulOrderMessage = "매도주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }

                if (GlobalVar.OperationMode == GlobalVar.OperationModeSimul && AutoOrder == true)
                {
                    Console.WriteLine(m_SysName + "주문나감" + m_TotalSigMan.CurVal.ToString("F2"));
                    return;
                }
            }
        }

        // 옵션 주문을 위한 코드 
        protected void SendOrder(EasyTrader.Signal.PriceSignal a_Signal, string a_Code)
        {
            if (m_OrderMan == null || a_Signal == null)
                return;

            bool AutoOrder = GlobalVar.AutoOrder;
            int OrderStartHour = GlobalVar.OrderStartHour;
            int OrderStartMin = GlobalVar.OrderStartMin;
            int OrderEndHour = GlobalVar.OrderEndHour;
            int OrderEndMin = GlobalVar.OrderEndMin;
            int OrderStartSignal = 1;
            int OrderEndSignal = 50;
            int PerOrderAmount = 1;
            int PerLiquidOrderAmount = 1;
            int FirstMaxOrderAmount = 3;

            if (m_SysType == GlobalVar.SysTypeJisuWaveHogaSummit)
            {
                AutoOrder = JisuWaveHogaSummitSysVar.AutoOrder;
                OrderStartHour = JisuWaveHogaSummitSysVar.OrderStartHour;
                OrderStartMin = JisuWaveHogaSummitSysVar.OrderStartMin;
                OrderEndHour = JisuWaveHogaSummitSysVar.OrderEndHour;
                OrderEndMin = JisuWaveHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = JisuWaveHogaSummitSysVar.SysStartState;
                OrderEndSignal = JisuWaveHogaSummitSysVar.SysEndState;
                PerOrderAmount = JisuWaveHogaSummitSysVar.PerOrderAmount;
                PerLiquidOrderAmount = JisuWaveHogaSummitSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = JisuWaveHogaSummitSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaWave)
            {
                AutoOrder = HogaWaveSysVar.AutoOrder;
                OrderStartHour = HogaWaveSysVar.OrderStartHour;
                OrderStartMin = HogaWaveSysVar.OrderStartMin;
                OrderEndHour = HogaWaveSysVar.OrderEndHour;
                OrderEndMin = HogaWaveSysVar.OrderEndMin;
                OrderStartSignal = HogaWaveSysVar.SysStartState;
                OrderEndSignal = HogaWaveSysVar.SysEndState;
                PerOrderAmount = HogaWaveSysVar.PerOrderAmount;
                PerLiquidOrderAmount = HogaWaveSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = HogaWaveSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeJisuWave)
            {
                AutoOrder = JisuWaveSysVar.AutoOrder;
                OrderStartHour = JisuWaveSysVar.OrderStartHour;
                OrderStartMin = JisuWaveSysVar.OrderStartMin;
                OrderEndHour = JisuWaveSysVar.OrderEndHour;
                OrderEndMin = JisuWaveSysVar.OrderEndMin;
                OrderStartSignal = JisuWaveSysVar.SysStartState;
                OrderEndSignal = JisuWaveSysVar.SysEndState;
                PerOrderAmount = JisuWaveSysVar.PerOrderAmount;
                PerLiquidOrderAmount = JisuWaveSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = JisuWaveSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSquareOcc)
            {
                AutoOrder = HogaSquareOccSysVar.AutoOrder;
                OrderStartHour = HogaSquareOccSysVar.OrderStartHour;
                OrderStartMin = HogaSquareOccSysVar.OrderStartMin;
                OrderEndHour = HogaSquareOccSysVar.OrderEndHour;
                OrderEndMin = HogaSquareOccSysVar.OrderEndMin;
                OrderStartSignal = HogaSquareOccSysVar.SysStartState;
                OrderEndSignal = HogaSquareOccSysVar.SysEndState;
                PerOrderAmount = HogaSquareOccSysVar.PerOrderAmount;
                PerLiquidOrderAmount = HogaSquareOccSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = HogaSquareOccSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSummit)
            {
                AutoOrder = HogaSummitSysVar.AutoOrder;
                OrderStartHour = HogaSummitSysVar.OrderStartHour;
                OrderStartMin = HogaSummitSysVar.OrderStartMin;
                OrderEndHour = HogaSummitSysVar.OrderEndHour;
                OrderEndMin = HogaSummitSysVar.OrderEndMin;
                OrderStartSignal = HogaSummitSysVar.SysStartState;
                OrderEndSignal = HogaSummitSysVar.SysEndState;
                PerOrderAmount = HogaSummitSysVar.PerOrderAmount;
                PerLiquidOrderAmount = HogaSummitSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = HogaSummitSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutSquareOcc)
            {
                AutoOrder = CallPutSquareOccSysVar.AutoOrder;
                OrderStartHour = CallPutSquareOccSysVar.OrderStartHour;
                OrderStartMin = CallPutSquareOccSysVar.OrderStartMin;
                OrderEndHour = CallPutSquareOccSysVar.OrderEndHour;
                OrderEndMin = CallPutSquareOccSysVar.OrderEndMin;
                OrderStartSignal = CallPutSquareOccSysVar.SysStartState;
                OrderEndSignal = CallPutSquareOccSysVar.SysEndState;
                PerOrderAmount = CallPutSquareOccSysVar.PerOrderAmount;
                PerLiquidOrderAmount = CallPutSquareOccSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = CallPutSquareOccSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypePureHogaSummit)
            {
                AutoOrder = PureHogaSummitSysVar.AutoOrder;
                OrderStartHour = PureHogaSummitSysVar.OrderStartHour;
                OrderStartMin = PureHogaSummitSysVar.OrderStartMin;
                OrderEndHour = PureHogaSummitSysVar.OrderEndHour;
                OrderEndMin = PureHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = PureHogaSummitSysVar.SysStartState;
                OrderEndSignal = PureHogaSummitSysVar.SysEndState;
                PerOrderAmount = PureHogaSummitSysVar.PerOrderAmount;
                PerLiquidOrderAmount = PureHogaSummitSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = PureHogaSummitSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeLooseHogaSummit)
            {
                AutoOrder = LooseHogaSummitSysVar.AutoOrder;
                OrderStartHour = LooseHogaSummitSysVar.OrderStartHour;
                OrderStartMin = LooseHogaSummitSysVar.OrderStartMin;
                OrderEndHour = LooseHogaSummitSysVar.OrderEndHour;
                OrderEndMin = LooseHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = LooseHogaSummitSysVar.SysStartState;
                OrderEndSignal = LooseHogaSummitSysVar.SysEndState;
                PerOrderAmount = LooseHogaSummitSysVar.PerOrderAmount;
                PerLiquidOrderAmount = LooseHogaSummitSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = LooseHogaSummitSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutInvDiv)
            {
                AutoOrder = CallPutInvDivSysVar.AutoOrder;
                OrderStartHour = CallPutInvDivSysVar.OrderStartHour;
                OrderStartMin = CallPutInvDivSysVar.OrderStartMin;
                OrderEndHour = CallPutInvDivSysVar.OrderEndHour;
                OrderEndMin = CallPutInvDivSysVar.OrderEndMin;
                OrderStartSignal = CallPutInvDivSysVar.SysStartState;
                OrderEndSignal = CallPutInvDivSysVar.SysEndState;
                PerOrderAmount = CallPutInvDivSysVar.PerOrderAmount;
                PerLiquidOrderAmount = CallPutInvDivSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = CallPutInvDivSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeTipAttack)
            {
                AutoOrder = TipAttackSysVar.AutoOrder;
                OrderStartHour = TipAttackSysVar.OrderStartHour;
                OrderStartMin = TipAttackSysVar.OrderStartMin;
                OrderEndHour = TipAttackSysVar.OrderEndHour;
                OrderEndMin = TipAttackSysVar.OrderEndMin;
                OrderStartSignal = TipAttackSysVar.SysStartState;
                OrderEndSignal = TipAttackSysVar.SysEndState;
                PerOrderAmount = TipAttackSysVar.PerOrderAmount;
                PerLiquidOrderAmount = TipAttackSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = TipAttackSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeOptPrice)
            {
                AutoOrder = OptPriceSysVar.AutoOrder;
                OrderStartHour = OptPriceSysVar.OrderStartHour;
                OrderStartMin = OptPriceSysVar.OrderStartMin;
                OrderEndHour = OptPriceSysVar.OrderEndHour;
                OrderEndMin = OptPriceSysVar.OrderEndMin;
                OrderStartSignal = OptPriceSysVar.SysStartState;
                OrderEndSignal = OptPriceSysVar.SysEndState;
                PerOrderAmount = OptPriceSysVar.PerOrderAmount;
                PerLiquidOrderAmount = OptPriceSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = OptPriceSysVar.FirstMaxOrderAmount;
            }

            // 자동 주문
            if (AutoOrder == true)
            {
                if (m_OrderMan.CanTakeAutoOrder(GlobalVar.TimeToInt(), OrderStartHour, OrderStartMin, OrderEndHour, OrderEndMin) == true)
                {
                    string sideCode = "";
                    if (a_Signal.Type == GlobalVar.SignalBuy) // 옵션일 경우 콜 매수
                    {
                        m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 옵션 매수 주문 발생", m_LogFileName, a_Signal);
                        sideCode = a_Code.Substring(0, 1);
                        if (sideCode == "2")
                            m_OrderMan.SendAutoLiquidAndOrder(GlobalVar.OrderBuy, FirstMaxOrderAmount, m_TotalSigMan.CurVal, a_Code);
                        GlobalVar.PlaySignalBuySound();
                    }
                    else if (a_Signal.Type == GlobalVar.SignalSell) // 옵션일 경우 풋 매수
                    {
                        m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 옵션 매도 주문 발생", m_LogFileName, a_Signal);
                        sideCode = a_Code.Substring(0, 1);
                        if (sideCode == "3")
                            m_OrderMan.SendAutoLiquidAndOrder(GlobalVar.OrderBuy, FirstMaxOrderAmount, m_TotalSigMan.CurVal, a_Code);
                        GlobalVar.PlaySignalSellSound();
                    }
                    else if (a_Signal.Type == GlobalVar.SignalBuyPartialLiquid) // 매수 일부 청산
                    {
                        m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 옵션 매수 일부청산 주문 발생", m_LogFileName, a_Signal);
                        m_OrderMan.SendLiquidOrder(PerLiquidOrderAmount, m_TotalSigMan.CurVal, a_Code);
                        GlobalVar.PlaySignalSellSound();
                    }
                    else if (a_Signal.Type == GlobalVar.SignalSellPartialLiquid) // 매도 일부 청산
                    {
                        m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 옵션 매도 일부청산 주문 발생", m_LogFileName, a_Signal);
                        m_OrderMan.SendLiquidOrder(PerLiquidOrderAmount, m_TotalSigMan.CurVal, a_Code);
                        GlobalVar.PlaySignalBuySound();
                    }
                    else if (a_Signal.Type == GlobalVar.SignalExitBuy)
                    {
                        m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 옵션 매수 청산 주문 발생", m_LogFileName, a_Signal);
                        m_OrderMan.SendAutoLiquid(a_Code);
                        GlobalVar.PlaySignalSellSound();
                    }
                    else if (a_Signal.Type == GlobalVar.SignalExitSell)
                    {
                        m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 옵션 매도 청산 주문 발생", m_LogFileName, a_Signal);
                        m_OrderMan.SendAutoLiquid(a_Code);
                        GlobalVar.PlaySignalBuySound();
                    }
                }
            }
            else
            {
                if (a_Signal.Type == GlobalVar.SignalBuy)
                {
                    GlobalVar.PlaySignalBuySound();
                    GlobalVar.SimulOrderMessage = "자동 주문 해제 상태 : 매수주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalSell)
                {
                    GlobalVar.PlaySignalSellSound();
                    GlobalVar.SimulOrderMessage = "자동 주문 해제 상태 : 매도주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalBuyPartialLiquid)
                {
                    GlobalVar.PlaySignalSellSound();
                    GlobalVar.SimulOrderMessage = "자동 주문 해제 상태 : 매수일부청산주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalSellPartialLiquid)
                {
                    GlobalVar.PlaySignalBuySound();
                    GlobalVar.SimulOrderMessage = "자동 주문 해제 상태 : 매도일부청산주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalExitBuy)
                {
                    GlobalVar.PlaySignalSellSound();
                    GlobalVar.SimulOrderMessage = "자동 주문 해제 상태 : 매수청산주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalExitSell)
                {
                    GlobalVar.PlaySignalBuySound();
                    GlobalVar.SimulOrderMessage = "자동 주문 해제 상태 : 매도청산주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }

                if (GlobalVar.OperationMode == GlobalVar.OperationModeSimul && AutoOrder == true)
                {
                    Console.WriteLine(m_SysName + "자동 주문 해제 상태 : 주문나감" + m_TotalSigMan.CurVal.ToString("F2"));
                    return;
                }
            }
        }


        // 옵션 주문을 위한 코드 
        protected void SendOrder(EasyTrader.Signal.PriceSignal a_Signal, string a_Code, int a_Target)
        {
            if (m_OrderMan == null || a_Signal == null)
                return;

            bool AutoOrder = GlobalVar.AutoOrder;
            int OrderStartHour = GlobalVar.OrderStartHour;
            int OrderStartMin = GlobalVar.OrderStartMin;
            int OrderEndHour = GlobalVar.OrderEndHour;
            int OrderEndMin = GlobalVar.OrderEndMin;
            int OrderStartSignal = 1;
            int OrderEndSignal = 50;
            int PerOrderAmount = 1;
            int PerLiquidOrderAmount = 1;
            int FirstMaxOrderAmount = 3;

            if (m_SysType == GlobalVar.SysTypeJisuWaveHogaSummit)
            {
                AutoOrder = JisuWaveHogaSummitSysVar.AutoOrder;
                OrderStartHour = JisuWaveHogaSummitSysVar.OrderStartHour;
                OrderStartMin = JisuWaveHogaSummitSysVar.OrderStartMin;
                OrderEndHour = JisuWaveHogaSummitSysVar.OrderEndHour;
                OrderEndMin = JisuWaveHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = JisuWaveHogaSummitSysVar.SysStartState;
                OrderEndSignal = JisuWaveHogaSummitSysVar.SysEndState;
                PerOrderAmount = JisuWaveHogaSummitSysVar.PerOrderAmount;
                PerLiquidOrderAmount = JisuWaveHogaSummitSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = JisuWaveHogaSummitSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaWave)
            {
                AutoOrder = HogaWaveSysVar.AutoOrder;
                OrderStartHour = HogaWaveSysVar.OrderStartHour;
                OrderStartMin = HogaWaveSysVar.OrderStartMin;
                OrderEndHour = HogaWaveSysVar.OrderEndHour;
                OrderEndMin = HogaWaveSysVar.OrderEndMin;
                OrderStartSignal = HogaWaveSysVar.SysStartState;
                OrderEndSignal = HogaWaveSysVar.SysEndState;
                PerOrderAmount = HogaWaveSysVar.PerOrderAmount;
                PerLiquidOrderAmount = HogaWaveSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = HogaWaveSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeJisuWave)
            {
                AutoOrder = JisuWaveSysVar.AutoOrder;
                OrderStartHour = JisuWaveSysVar.OrderStartHour;
                OrderStartMin = JisuWaveSysVar.OrderStartMin;
                OrderEndHour = JisuWaveSysVar.OrderEndHour;
                OrderEndMin = JisuWaveSysVar.OrderEndMin;
                OrderStartSignal = JisuWaveSysVar.SysStartState;
                OrderEndSignal = JisuWaveSysVar.SysEndState;
                PerOrderAmount = JisuWaveSysVar.PerOrderAmount;
                PerLiquidOrderAmount = JisuWaveSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = JisuWaveSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSquareOcc)
            {
                AutoOrder = HogaSquareOccSysVar.AutoOrder;
                OrderStartHour = HogaSquareOccSysVar.OrderStartHour;
                OrderStartMin = HogaSquareOccSysVar.OrderStartMin;
                OrderEndHour = HogaSquareOccSysVar.OrderEndHour;
                OrderEndMin = HogaSquareOccSysVar.OrderEndMin;
                OrderStartSignal = HogaSquareOccSysVar.SysStartState;
                OrderEndSignal = HogaSquareOccSysVar.SysEndState;
                PerOrderAmount = HogaSquareOccSysVar.PerOrderAmount;
                PerLiquidOrderAmount = HogaSquareOccSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = HogaSquareOccSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSummit)
            {
                AutoOrder = HogaSummitSysVar.AutoOrder;
                OrderStartHour = HogaSummitSysVar.OrderStartHour;
                OrderStartMin = HogaSummitSysVar.OrderStartMin;
                OrderEndHour = HogaSummitSysVar.OrderEndHour;
                OrderEndMin = HogaSummitSysVar.OrderEndMin;
                OrderStartSignal = HogaSummitSysVar.SysStartState;
                OrderEndSignal = HogaSummitSysVar.SysEndState;
                PerOrderAmount = HogaSummitSysVar.PerOrderAmount;
                PerLiquidOrderAmount = HogaSummitSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = HogaSummitSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutSquareOcc)
            {
                AutoOrder = CallPutSquareOccSysVar.AutoOrder;
                OrderStartHour = CallPutSquareOccSysVar.OrderStartHour;
                OrderStartMin = CallPutSquareOccSysVar.OrderStartMin;
                OrderEndHour = CallPutSquareOccSysVar.OrderEndHour;
                OrderEndMin = CallPutSquareOccSysVar.OrderEndMin;
                OrderStartSignal = CallPutSquareOccSysVar.SysStartState;
                OrderEndSignal = CallPutSquareOccSysVar.SysEndState;
                PerOrderAmount = CallPutSquareOccSysVar.PerOrderAmount;
                PerLiquidOrderAmount = CallPutSquareOccSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = CallPutSquareOccSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypePureHogaSummit)
            {
                AutoOrder = PureHogaSummitSysVar.AutoOrder;
                OrderStartHour = PureHogaSummitSysVar.OrderStartHour;
                OrderStartMin = PureHogaSummitSysVar.OrderStartMin;
                OrderEndHour = PureHogaSummitSysVar.OrderEndHour;
                OrderEndMin = PureHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = PureHogaSummitSysVar.SysStartState;
                OrderEndSignal = PureHogaSummitSysVar.SysEndState;
                PerOrderAmount = PureHogaSummitSysVar.PerOrderAmount;
                PerLiquidOrderAmount = PureHogaSummitSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = PureHogaSummitSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeLooseHogaSummit)
            {
                AutoOrder = LooseHogaSummitSysVar.AutoOrder;
                OrderStartHour = LooseHogaSummitSysVar.OrderStartHour;
                OrderStartMin = LooseHogaSummitSysVar.OrderStartMin;
                OrderEndHour = LooseHogaSummitSysVar.OrderEndHour;
                OrderEndMin = LooseHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = LooseHogaSummitSysVar.SysStartState;
                OrderEndSignal = LooseHogaSummitSysVar.SysEndState;
                PerOrderAmount = LooseHogaSummitSysVar.PerOrderAmount;
                PerLiquidOrderAmount = LooseHogaSummitSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = LooseHogaSummitSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutInvDiv)
            {
                AutoOrder = CallPutInvDivSysVar.AutoOrder;
                OrderStartHour = CallPutInvDivSysVar.OrderStartHour;
                OrderStartMin = CallPutInvDivSysVar.OrderStartMin;
                OrderEndHour = CallPutInvDivSysVar.OrderEndHour;
                OrderEndMin = CallPutInvDivSysVar.OrderEndMin;
                OrderStartSignal = CallPutInvDivSysVar.SysStartState;
                OrderEndSignal = CallPutInvDivSysVar.SysEndState;
                PerOrderAmount = CallPutInvDivSysVar.PerOrderAmount;
                PerLiquidOrderAmount = CallPutInvDivSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = CallPutInvDivSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeTipAttack)
            {
                AutoOrder = TipAttackSysVar.AutoOrder;
                OrderStartHour = TipAttackSysVar.OrderStartHour;
                OrderStartMin = TipAttackSysVar.OrderStartMin;
                OrderEndHour = TipAttackSysVar.OrderEndHour;
                OrderEndMin = TipAttackSysVar.OrderEndMin;
                OrderStartSignal = TipAttackSysVar.SysStartState;
                OrderEndSignal = TipAttackSysVar.SysEndState;
                PerOrderAmount = TipAttackSysVar.PerOrderAmount;
                PerLiquidOrderAmount = TipAttackSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = TipAttackSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeOptPrice)
            {
                AutoOrder = OptPriceSysVar.AutoOrder;
                OrderStartHour = OptPriceSysVar.OrderStartHour;
                OrderStartMin = OptPriceSysVar.OrderStartMin;
                OrderEndHour = OptPriceSysVar.OrderEndHour;
                OrderEndMin = OptPriceSysVar.OrderEndMin;
                OrderStartSignal = OptPriceSysVar.SysStartState;
                OrderEndSignal = OptPriceSysVar.SysEndState;
                PerOrderAmount = OptPriceSysVar.PerOrderAmount;
                PerLiquidOrderAmount = OptPriceSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = OptPriceSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeOptMainPrice)
            {
                AutoOrder = OptMainPriceSysVar.AutoOrder;
                OrderStartHour = OptMainPriceSysVar.OrderStartHour;
                OrderStartMin = OptMainPriceSysVar.OrderStartMin;
                OrderEndHour = OptMainPriceSysVar.OrderEndHour;
                OrderEndMin = OptMainPriceSysVar.OrderEndMin;
                OrderStartSignal = OptMainPriceSysVar.SysStartState;
                OrderEndSignal = OptMainPriceSysVar.SysEndState;
                PerOrderAmount = OptMainPriceSysVar.PerOrderAmount;
                PerLiquidOrderAmount = OptMainPriceSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = OptMainPriceSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeOptCenterPrice)
            {
                AutoOrder = OptCenterPriceSysVar.AutoOrder;
                OrderStartHour = OptCenterPriceSysVar.OrderStartHour;
                OrderStartMin = OptCenterPriceSysVar.OrderStartMin;
                OrderEndHour = OptCenterPriceSysVar.OrderEndHour;
                OrderEndMin = OptCenterPriceSysVar.OrderEndMin;
                OrderStartSignal = OptCenterPriceSysVar.SysStartState;
                OrderEndSignal = OptCenterPriceSysVar.SysEndState;
                PerOrderAmount = OptCenterPriceSysVar.PerOrderAmount;
                PerLiquidOrderAmount = OptCenterPriceSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = OptCenterPriceSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeOptBothSell)
            {
                AutoOrder = OptBothSellSysVar.AutoOrder;
                OrderStartHour = OptBothSellSysVar.OrderStartHour;
                OrderStartMin = OptBothSellSysVar.OrderStartMin;
                OrderEndHour = OptBothSellSysVar.OrderEndHour;
                OrderEndMin = OptBothSellSysVar.OrderEndMin;
                OrderStartSignal = OptBothSellSysVar.SysStartState;
                OrderEndSignal = OptBothSellSysVar.SysEndState;
                PerOrderAmount = OptBothSellSysVar.PerOrderAmount;
                PerLiquidOrderAmount = OptBothSellSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = OptBothSellSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeOptBend)
            {
                AutoOrder = OptBendSysVar.AutoOrder;
                OrderStartHour = OptBendSysVar.OrderStartHour;
                OrderStartMin = OptBendSysVar.OrderStartMin;
                OrderEndHour = OptBendSysVar.OrderEndHour;
                OrderEndMin = OptBendSysVar.OrderEndMin;
                OrderStartSignal = OptBendSysVar.SysStartState;
                OrderEndSignal = OptBendSysVar.SysEndState;
                PerOrderAmount = OptBendSysVar.PerOrderAmount;
                PerLiquidOrderAmount = OptBendSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = OptBendSysVar.FirstMaxOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeSubject)
            {
                AutoOrder = SubjectSysVar.AutoOrder;
                OrderStartHour = SubjectSysVar.OrderStartHour;
                OrderStartMin = SubjectSysVar.OrderStartMin;
                OrderEndHour = SubjectSysVar.OrderEndHour;
                OrderEndMin = SubjectSysVar.OrderEndMin;
                OrderStartSignal = SubjectSysVar.SysStartState;
                OrderEndSignal = SubjectSysVar.SysEndState;
                PerOrderAmount = SubjectSysVar.PerOrderAmount;
                PerLiquidOrderAmount = SubjectSysVar.PerLiquidOrderAmount;
                FirstMaxOrderAmount = SubjectSysVar.FirstMaxOrderAmount;
            }

            // 자동 주문
            if (AutoOrder == true)
            {
                if (m_OrderMan.CanTakeAutoOrder(GlobalVar.TimeToInt(), OrderStartHour, OrderStartMin, OrderEndHour, OrderEndMin) == true)
                {
                    if (a_Target == GlobalVar.OrderTargetOption)
                    {
                        string sideCode = "";
                        if (a_Signal.Type == GlobalVar.SignalBuy) // 옵션일 경우 콜 매수
                        {
                            m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 옵션 매수 주문 발생", m_LogFileName, a_Signal);
                            sideCode = a_Code.Substring(0, 1);
                            if (sideCode == "2")
                                m_OrderMan.SendAutoLiquidAndOrder(GlobalVar.OrderBuy, FirstMaxOrderAmount, m_TotalSigMan.CurVal, a_Code);
                            GlobalVar.PlaySignalBuySound();
                        }
                        else if (a_Signal.Type == GlobalVar.SignalSell) // 옵션일 경우 풋 매수
                        {
                            m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 옵션 매도 주문 발생", m_LogFileName, a_Signal);
                            sideCode = a_Code.Substring(0, 1);
                            if (sideCode == "3")
                                m_OrderMan.SendAutoLiquidAndOrder(GlobalVar.OrderBuy, FirstMaxOrderAmount, m_TotalSigMan.CurVal, a_Code);
                            GlobalVar.PlaySignalSellSound();
                        }
                        else if (a_Signal.Type == GlobalVar.SignalBuyPartialLiquid) // 매수 일부 청산
                        {
                            m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 옵션 매수 일부청산 주문 발생", m_LogFileName, a_Signal);
                            m_OrderMan.SendLiquidOrder(PerLiquidOrderAmount, m_TotalSigMan.CurVal, a_Code);
                            GlobalVar.PlaySignalSellSound();
                        }
                        else if (a_Signal.Type == GlobalVar.SignalSellPartialLiquid) // 매도 일부 청산
                        {
                            m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 옵션 매도 일부청산 주문 발생", m_LogFileName, a_Signal);
                            m_OrderMan.SendLiquidOrder(PerLiquidOrderAmount, m_TotalSigMan.CurVal, a_Code);
                            GlobalVar.PlaySignalBuySound();
                        }
                        else if (a_Signal.Type == GlobalVar.SignalExitBuy)
                        {
                            m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 옵션 매수 청산 주문 발생", m_LogFileName, a_Signal);
                            m_OrderMan.SendAutoLiquid(a_Code);
                            GlobalVar.PlaySignalSellSound();
                        }
                        else if (a_Signal.Type == GlobalVar.SignalExitSell)
                        {
                            m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 옵션 매도 청산 주문 발생", m_LogFileName, a_Signal);
                            m_OrderMan.SendAutoLiquid(a_Code);
                            GlobalVar.PlaySignalBuySound();
                        }
                    }
                    else if (a_Target == GlobalVar.OrderTargetFuture)
                    {
                        if (a_Signal.Type == GlobalVar.SignalBuy)
                        {
                            m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 선물 매수 주문 발생", m_LogFileName, a_Signal);
                            m_OrderMan.SendAutoLiquidAndOrder(GlobalVar.OrderBuy, FirstMaxOrderAmount, m_TotalSigMan.CurVal);
                            GlobalVar.PlaySignalBuySound();
                        }
                        else if (a_Signal.Type == GlobalVar.SignalSell)
                        {
                            m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 선물 매도 주문 발생", m_LogFileName, a_Signal);
                            m_OrderMan.SendAutoLiquidAndOrder(GlobalVar.OrderSell, FirstMaxOrderAmount, m_TotalSigMan.CurVal);
                            GlobalVar.PlaySignalSellSound();
                        }
                        else if (a_Signal.Type == GlobalVar.SignalBuyPartialLiquid) // 매수 일부 청산
                        {
                            m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 선물 매수 일부청산 주문 발생", m_LogFileName, a_Signal);
                            m_OrderMan.SendLiquidOrder(PerLiquidOrderAmount, m_TotalSigMan.CurVal);
                            GlobalVar.PlaySignalSellSound();
                        }
                        else if (a_Signal.Type == GlobalVar.SignalSellPartialLiquid) // 매도 일부 청산
                        {
                            m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 선물 매도 일부청산 주문 발생", m_LogFileName, a_Signal);
                            m_OrderMan.SendLiquidOrder(PerLiquidOrderAmount, m_TotalSigMan.CurVal);
                            GlobalVar.PlaySignalBuySound();
                        }
                        else if (a_Signal.Type == GlobalVar.SignalExitBuy)
                        {
                            m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 선물 매수 청산 주문 발생", m_LogFileName, a_Signal);
                            m_OrderMan.SendAutoLiquid();
                            GlobalVar.PlaySignalSellSound();
                        }
                        else if (a_Signal.Type == GlobalVar.SignalExitSell)
                        {
                            m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 선물 매도 청산 주문 발생", m_LogFileName, a_Signal);
                            m_OrderMan.SendAutoLiquid();
                            GlobalVar.PlaySignalBuySound();
                        }
                    }
                }
            }
            else
            {
                if (a_Signal.Type == GlobalVar.SignalBuy)
                {
                    m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 자동 주문 해제 상태 : 매수 주문 발생", m_LogFileName, a_Signal);
                    GlobalVar.PlaySignalBuySound();
                    GlobalVar.SimulOrderMessage = "매수주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalSell)
                {
                    m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 자동 주문 해제 상태 : 매도 주문 발생", m_LogFileName, a_Signal);
                    GlobalVar.PlaySignalSellSound();
                    GlobalVar.SimulOrderMessage = "매도주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalBuyPartialLiquid)
                {
                    m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 자동 주문 해제 상태 : 매수 일부청산 주문 발생", m_LogFileName, a_Signal);
                    GlobalVar.PlaySignalSellSound();
                    GlobalVar.SimulOrderMessage = "매수일부청산주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalSellPartialLiquid)
                {
                    m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 자동 주문 해제 상태 : 매도 일부청산 주문 발생", m_LogFileName, a_Signal);
                    GlobalVar.PlaySignalBuySound();
                    GlobalVar.SimulOrderMessage = "매도일부청산주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalExitBuy)
                {
                    m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 자동 주문 해제 상태 : 매수 청산 주문 발생", m_LogFileName, a_Signal);
                    GlobalVar.PlaySignalSellSound();
                    GlobalVar.SimulOrderMessage = "매수청산주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalExitSell)
                {
                    m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 자동 주문 해제 상태 : 매도 청산 주문 발생", m_LogFileName, a_Signal);
                    GlobalVar.PlaySignalBuySound();
                    GlobalVar.SimulOrderMessage = "매도청산주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }

                if (GlobalVar.OperationMode == GlobalVar.OperationModeSimul && AutoOrder == true)
                {
                    Console.WriteLine(m_SysName + "자동 주문 해제 상태 : 주문나감" + m_TotalSigMan.CurVal.ToString("F2"));
                    return;
                }
            }
        }

        protected void SendOrder(EasyTrader.Signal.PriceSignal a_Signal)
        {
            if (m_OrderMan == null || a_Signal == null)
                return;

            bool AutoOrder = GlobalVar.AutoOrder;
            int OrderStartHour = GlobalVar.OrderStartHour;
            int OrderStartMin = GlobalVar.OrderStartMin;
            int OrderEndHour = GlobalVar.OrderEndHour;
            int OrderEndMin = GlobalVar.OrderEndMin;
            int OrderStartSignal = 1;
            int OrderEndSignal = 50;
            int PerOrderAmount = 1;
            int PerLiquidOrderAmount = 1;

            if (m_SysType == GlobalVar.SysTypeJisuWaveHogaSummit)
            {
                AutoOrder = JisuWaveHogaSummitSysVar.AutoOrder;
                OrderStartHour = JisuWaveHogaSummitSysVar.OrderStartHour;
                OrderStartMin = JisuWaveHogaSummitSysVar.OrderStartMin;
                OrderEndHour = JisuWaveHogaSummitSysVar.OrderEndHour;
                OrderEndMin = JisuWaveHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = JisuWaveHogaSummitSysVar.SysStartState;
                OrderEndSignal = JisuWaveHogaSummitSysVar.SysEndState;
                PerOrderAmount = JisuWaveHogaSummitSysVar.PerOrderAmount;
                PerLiquidOrderAmount = JisuWaveHogaSummitSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaWave)
            {
                AutoOrder = HogaWaveSysVar.AutoOrder;
                OrderStartHour = HogaWaveSysVar.OrderStartHour;
                OrderStartMin = HogaWaveSysVar.OrderStartMin;
                OrderEndHour = HogaWaveSysVar.OrderEndHour;
                OrderEndMin = HogaWaveSysVar.OrderEndMin;
                OrderStartSignal = HogaWaveSysVar.SysStartState;
                OrderEndSignal = HogaWaveSysVar.SysEndState;
                PerOrderAmount = HogaWaveSysVar.PerOrderAmount;
                PerLiquidOrderAmount = HogaWaveSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeJisuWave)
            {
                AutoOrder = JisuWaveSysVar.AutoOrder;
                OrderStartHour = JisuWaveSysVar.OrderStartHour;
                OrderStartMin = JisuWaveSysVar.OrderStartMin;
                OrderEndHour = JisuWaveSysVar.OrderEndHour;
                OrderEndMin = JisuWaveSysVar.OrderEndMin;
                OrderStartSignal = JisuWaveSysVar.SysStartState;
                OrderEndSignal = JisuWaveSysVar.SysEndState;
                PerOrderAmount = JisuWaveSysVar.PerOrderAmount;
                PerLiquidOrderAmount = JisuWaveSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSquareOcc)
            {
                AutoOrder = HogaSquareOccSysVar.AutoOrder;
                OrderStartHour = HogaSquareOccSysVar.OrderStartHour;
                OrderStartMin = HogaSquareOccSysVar.OrderStartMin;
                OrderEndHour = HogaSquareOccSysVar.OrderEndHour;
                OrderEndMin = HogaSquareOccSysVar.OrderEndMin;
                OrderStartSignal = HogaSquareOccSysVar.SysStartState;
                OrderEndSignal = HogaSquareOccSysVar.SysEndState;
                PerOrderAmount = HogaSquareOccSysVar.PerOrderAmount;
                PerLiquidOrderAmount = HogaSquareOccSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeHogaSummit)
            {
                AutoOrder = HogaSummitSysVar.AutoOrder;
                OrderStartHour = HogaSummitSysVar.OrderStartHour;
                OrderStartMin = HogaSummitSysVar.OrderStartMin;
                OrderEndHour = HogaSummitSysVar.OrderEndHour;
                OrderEndMin = HogaSummitSysVar.OrderEndMin;
                OrderStartSignal = HogaSummitSysVar.SysStartState;
                OrderEndSignal = HogaSummitSysVar.SysEndState;
                PerOrderAmount = HogaSummitSysVar.PerOrderAmount;
                PerLiquidOrderAmount = HogaSummitSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutSquareOcc)
            {
                AutoOrder = CallPutSquareOccSysVar.AutoOrder;
                OrderStartHour = CallPutSquareOccSysVar.OrderStartHour;
                OrderStartMin = CallPutSquareOccSysVar.OrderStartMin;
                OrderEndHour = CallPutSquareOccSysVar.OrderEndHour;
                OrderEndMin = CallPutSquareOccSysVar.OrderEndMin;
                OrderStartSignal = CallPutSquareOccSysVar.SysStartState;
                OrderEndSignal = CallPutSquareOccSysVar.SysEndState;
                PerOrderAmount = CallPutSquareOccSysVar.PerOrderAmount;
                PerLiquidOrderAmount = CallPutSquareOccSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypePureHogaSummit)
            {
                AutoOrder = PureHogaSummitSysVar.AutoOrder;
                OrderStartHour = PureHogaSummitSysVar.OrderStartHour;
                OrderStartMin = PureHogaSummitSysVar.OrderStartMin;
                OrderEndHour = PureHogaSummitSysVar.OrderEndHour;
                OrderEndMin = PureHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = PureHogaSummitSysVar.SysStartState;
                OrderEndSignal = PureHogaSummitSysVar.SysEndState;
                PerOrderAmount = PureHogaSummitSysVar.PerOrderAmount;
                PerLiquidOrderAmount = PureHogaSummitSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeLooseHogaSummit)
            {
                AutoOrder = LooseHogaSummitSysVar.AutoOrder;
                OrderStartHour = LooseHogaSummitSysVar.OrderStartHour;
                OrderStartMin = LooseHogaSummitSysVar.OrderStartMin;
                OrderEndHour = LooseHogaSummitSysVar.OrderEndHour;
                OrderEndMin = LooseHogaSummitSysVar.OrderEndMin;
                OrderStartSignal = LooseHogaSummitSysVar.SysStartState;
                OrderEndSignal = LooseHogaSummitSysVar.SysEndState;
                PerOrderAmount = LooseHogaSummitSysVar.PerOrderAmount;
                PerLiquidOrderAmount = LooseHogaSummitSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeCallPutInvDiv)
            {
                AutoOrder = CallPutInvDivSysVar.AutoOrder;
                OrderStartHour = CallPutInvDivSysVar.OrderStartHour;
                OrderStartMin = CallPutInvDivSysVar.OrderStartMin;
                OrderEndHour = CallPutInvDivSysVar.OrderEndHour;
                OrderEndMin = CallPutInvDivSysVar.OrderEndMin;
                OrderStartSignal = CallPutInvDivSysVar.SysStartState;
                OrderEndSignal = CallPutInvDivSysVar.SysEndState;
                PerOrderAmount = CallPutInvDivSysVar.PerOrderAmount;
                PerLiquidOrderAmount = CallPutInvDivSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeTipAttack)
            {
                AutoOrder = TipAttackSysVar.AutoOrder;
                OrderStartHour = TipAttackSysVar.OrderStartHour;
                OrderStartMin = TipAttackSysVar.OrderStartMin;
                OrderEndHour = TipAttackSysVar.OrderEndHour;
                OrderEndMin = TipAttackSysVar.OrderEndMin;
                OrderStartSignal = TipAttackSysVar.SysStartState;
                OrderEndSignal = TipAttackSysVar.SysEndState;
                PerOrderAmount = TipAttackSysVar.PerOrderAmount;
                PerLiquidOrderAmount = TipAttackSysVar.PerLiquidOrderAmount;
            }
            else if (m_SysType == GlobalVar.SysTypeOptPrice)
            {
                AutoOrder = OptPriceSysVar.AutoOrder;
                OrderStartHour = OptPriceSysVar.OrderStartHour;
                OrderStartMin = OptPriceSysVar.OrderStartMin;
                OrderEndHour = OptPriceSysVar.OrderEndHour;
                OrderEndMin = OptPriceSysVar.OrderEndMin;
                OrderStartSignal = OptPriceSysVar.SysStartState;
                OrderEndSignal = OptPriceSysVar.SysEndState;
                PerOrderAmount = OptPriceSysVar.PerOrderAmount;
                PerLiquidOrderAmount = OptPriceSysVar.PerLiquidOrderAmount;
            }

            // 자동 주문
            if (AutoOrder == true)
            {
                if (m_OrderMan.CanTakeAutoOrder(GlobalVar.TimeToInt(), OrderStartHour, OrderStartMin, OrderEndHour, OrderEndMin) == true)
                {
                    if (a_Signal.Type == GlobalVar.SignalBuy)
                    {
                        m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 매수 주문 발생", m_LogFileName, a_Signal);
                        m_OrderMan.SendAutoLiquidAndOrder(GlobalVar.OrderBuy, PerOrderAmount, m_TotalSigMan.CurVal);
                        GlobalVar.PlaySignalBuySound();
                    }
                    else if (a_Signal.Type == GlobalVar.SignalSell)
                    {
                        m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 매도 주문 발생", m_LogFileName, a_Signal);
                        m_OrderMan.SendAutoLiquidAndOrder(GlobalVar.OrderSell, PerOrderAmount, m_TotalSigMan.CurVal);
                        GlobalVar.PlaySignalSellSound();
                    }
                    else if (a_Signal.Type == GlobalVar.SignalBuyPartialLiquid) // 매수 일부 청산
                    {
                        m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 매수 일부청산 주문 발생", m_LogFileName, a_Signal);
                        m_OrderMan.SendLiquidOrder(PerLiquidOrderAmount, m_TotalSigMan.CurVal);
                        GlobalVar.PlaySignalSellSound();
                    }
                    else if (a_Signal.Type == GlobalVar.SignalSellPartialLiquid) // 매도 일부 청산
                    {
                        m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 매도 일부청산 주문 발생", m_LogFileName, a_Signal);
                        m_OrderMan.SendLiquidOrder(PerLiquidOrderAmount, m_TotalSigMan.CurVal);
                        GlobalVar.PlaySignalBuySound();
                    }
                    else if (a_Signal.Type == GlobalVar.SignalExitBuy)
                    {
                        m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 매수 청산 주문 발생", m_LogFileName, a_Signal);
                        m_OrderMan.SendAutoLiquid();
                        GlobalVar.PlaySignalSellSound();
                    }
                    else if (a_Signal.Type == GlobalVar.SignalExitSell)
                    {
                        m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 매도 청산 주문 발생", m_LogFileName, a_Signal);
                        m_OrderMan.SendAutoLiquid();
                        GlobalVar.PlaySignalBuySound();
                    }
                }
            }
            else
            {
                if (a_Signal.Type == GlobalVar.SignalBuy)
                {
                    m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 자동 주문 해제 상태 : 매수 주문 발생", m_LogFileName, a_Signal);
                    GlobalVar.PlaySignalBuySound();
                    GlobalVar.SimulOrderMessage = "매수주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalSell)
                {
                    m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 자동 주문 해제 상태 : 매도 주문 발생", m_LogFileName, a_Signal);
                    GlobalVar.PlaySignalSellSound();
                    GlobalVar.SimulOrderMessage = "매도주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalBuyPartialLiquid)
                {
                    m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 자동 주문 해제 상태 : 매수 일부청산 주문 발생", m_LogFileName, a_Signal);
                    GlobalVar.PlaySignalSellSound();
                    GlobalVar.SimulOrderMessage = "매수일부청산주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalSellPartialLiquid)
                {
                    m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 자동 주문 해제 상태 : 매도 일부청산 주문 발생", m_LogFileName, a_Signal);
                    GlobalVar.PlaySignalBuySound();
                    GlobalVar.SimulOrderMessage = "매도일부청산주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalExitBuy)
                {
                    m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 자동 주문 해제 상태 : 매수 청산 주문 발생", m_LogFileName, a_Signal);
                    GlobalVar.PlaySignalSellSound();
                    GlobalVar.SimulOrderMessage = "매수청산주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }
                else if (a_Signal.Type == GlobalVar.SignalExitSell)
                {
                    m_TotalSigMan.WriteSignalLog(m_SysName + " >>>>>>> 자동 주문 해제 상태 : 매도 청산 주문 발생", m_LogFileName, a_Signal);
                    GlobalVar.PlaySignalBuySound();
                    GlobalVar.SimulOrderMessage = "매도청산주문완료" + "<" + m_TotalSigMan.CurVal.ToString("F2") + ">";
                }

                if (GlobalVar.OperationMode == GlobalVar.OperationModeSimul && AutoOrder == true)
                {
                    Console.WriteLine(m_SysName + "자동 주문 해제 상태 : 주문나감" + m_TotalSigMan.CurVal.ToString("F2"));
                    return;
                }
            }
        }
    }
}
